﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Medianamik.Core.Synchronization
{
    [Serializable]
    public enum PropertyType
    {
        Default,
        ManyToMany
    }

    public struct PropertyMapping
    {
        public PropertyMapping(string sourcePropertyName, string medianamikPropertyName,
            string cultureName, object defaultValue, string referencedTypeName, string referencedPropertyName,
            PropertyType propertyType)
        {
            _sourcePropertyName = sourcePropertyName;
            _medianamikPropertyName = medianamikPropertyName;
            _cultureName = cultureName;
            _defaultValue = defaultValue;
            _referencedTypeName = referencedTypeName;
            _referencedPropertyName = referencedPropertyName;
            _temporary = false;
            _propertyType = propertyType;
        }

        public PropertyMapping(string sourcePropertyName, string medianamikPropertyName,
            string cultureName, object defaultValue, string referencedTypeName, string referencedPropertyName)
        {
            _sourcePropertyName = sourcePropertyName;
            _medianamikPropertyName = medianamikPropertyName;
            _cultureName = cultureName;
            _defaultValue = defaultValue;
            _referencedTypeName = referencedTypeName;
            _referencedPropertyName = referencedPropertyName;
            _temporary = false;
            _propertyType = PropertyType.Default;
        }

        public PropertyMapping(string sourcePropertyName, string medianamikPropertyName,
            string cultureName, object defaultValue, string referencedTypeName)
        {
            _sourcePropertyName = sourcePropertyName;
            _medianamikPropertyName = medianamikPropertyName;
            _cultureName = cultureName;
            _defaultValue = defaultValue;
            _referencedTypeName = referencedTypeName;
            _referencedPropertyName = null;
            _temporary = false;
            _propertyType = PropertyType.Default;
        }

        public PropertyMapping(string sourcePropertyName, string medianamikPropertyName,
            string cultureName)
        {
            _sourcePropertyName = sourcePropertyName;
            _medianamikPropertyName = medianamikPropertyName;
            _cultureName = cultureName;
            _defaultValue = null;
            _referencedTypeName = null;
            _referencedPropertyName = null;
            _temporary = false;
            _propertyType = PropertyType.Default;
        }

        public PropertyMapping(string lookupColumnName)
        {
            _sourcePropertyName = lookupColumnName;
            _medianamikPropertyName = lookupColumnName;
            _cultureName = null;
            _defaultValue = null;
            _referencedTypeName = null;
            _referencedPropertyName = null;
            _temporary = true;
            _propertyType = PropertyType.Default;
        }

        public bool Temporary { get { return _temporary; } }
        bool _temporary;

        public string SourcePropertyName { get { return _sourcePropertyName; } }
        string _sourcePropertyName;

        public string ReferencedTypeName { get { return _referencedTypeName; } }
        string _referencedTypeName;

        public string ReferencedPropertyName { get { return _referencedPropertyName; } }
        string _referencedPropertyName;

        public string MedianamikPropertyName { get { return _medianamikPropertyName; } }
        string _medianamikPropertyName;

        public PropertyType PropertyType { get { return _propertyType; } }
        PropertyType _propertyType;        

        public string CultureName { get { return _cultureName; } }
        string _cultureName;

        public object DefaultValue { get { return _defaultValue; } }
        object _defaultValue;
    }
}
